<template>
  <view class="container">
    <!-- 标题区域 -->
    <view class="header-section">
      <text class="animated-gradient-text title">社交圈子</text>
      <text class="subtitle">UI组件测试页面</text>
    </view>

    <!-- u-view组件测试 -->
    <view class="test-section">
      <view class="section-title">u-view UI 组件测试</view>
      
      <!-- 按钮测试 -->
      <view class="button-group">
        <u-button type="primary" text="主要按钮" @click="showToast"></u-button>
        <u-button type="success" text="成功按钮" class="ml-10"></u-button>
        <u-button type="warning" text="警告按钮" class="ml-10"></u-button>
      </view>

      <!-- 卡片测试 -->
      <view class="modern-card mt-20">
        <view class="card-header flex-between">
          <text class="card-title">现代化卡片</text>
          <u-icon name="heart" color="#667eea" size="20"></u-icon>
        </view>
        <text class="card-content">这是一个使用了毛玻璃效果和渐变色的现代化卡片设计</text>
      </view>

      <!-- 头像测试 -->
      <view class="avatar-section mt-20">
        <view class="section-title">头像样式测试</view>
        <view class="avatar-group flex-center">
          <u-avatar 
            src="https://cdn.uviewui.com/uview/album/1.jpg" 
            size="60"
            class="avatar-gradient"
          ></u-avatar>
          <u-avatar 
            src="https://cdn.uviewui.com/uview/album/2.jpg" 
            size="60"
            class="avatar-gradient ml-10"
          ></u-avatar>
          <u-avatar 
            src="https://cdn.uviewui.com/uview/album/3.jpg" 
            size="60"
            class="avatar-gradient ml-10"
          ></u-avatar>
        </view>
      </view>

      <!-- 标签测试 -->
      <view class="tag-section mt-20">
        <view class="section-title">标签样式测试</view>
        <view class="tag-group">
          <view class="tag-gradient">科技</view>
          <view class="tag-gradient ml-10">生活</view>
          <view class="tag-gradient ml-10">娱乐</view>
          <view class="tag-gradient ml-10">音乐</view>
        </view>
      </view>

      <!-- 输入框测试 -->
      <view class="input-section mt-20">
        <view class="section-title">输入框样式测试</view>
        <u-input 
          v-model="inputValue" 
          placeholder="请输入内容" 
          class="modern-input"
          border="none"
        ></u-input>
      </view>

      <!-- 毛玻璃卡片测试 -->
      <view class="glass-card mt-20">
        <view class="glass-header">
          <text class="glass-title">毛玻璃效果卡片</text>
        </view>
        <text class="glass-content">这是一个具有毛玻璃背景效果的卡片，营造现代感的视觉体验</text>
      </view>

      <!-- 渐变按钮测试 -->
      <view class="gradient-section mt-20">
        <view class="section-title">自定义渐变按钮</view>
        <button class="gradient-button" @click="showModal">
          <text class="button-text">渐变按钮</text>
        </button>
      </view>

      <!-- 浮动动画测试 -->
      <view class="animation-section mt-20">
        <view class="section-title">动画效果测试</view>
        <view class="float-animation">
          <u-icon name="heart-fill" color="#667eea" size="40"></u-icon>
        </view>
      </view>
    </view>

    <!-- Toast提示 -->
    
    
    <!-- 模态框 -->
    <u-modal 
      v-model="showModalFlag" 
      title="提示" 
      content="这是一个u-view模态框组件"
      show-cancel-button
    ></u-modal>
  </view>
</template>

<script>
export default {
  data() {
    return {
      inputValue: '',
      showModalFlag: false
    }
  },
  methods: {
    showToast(title, type = 'default') {
      // 使用 uView 2.0 的 toast 方法
      this.$u.toast(title)
    },
    showModal() {
      this.showModalFlag = true
    }
  }
}
</script>

<style lang="scss" scoped>
.container {
  padding: 20px;
  min-height: 100vh;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.header-section {
  text-align: center;
  margin-bottom: 30px;
  
  .title {
    font-size: 32px;
    font-weight: bold;
    display: block;
    margin-bottom: 10px;
  }
  
  .subtitle {
    font-size: 16px;
    color: #666;
  }
}

.test-section {
  .section-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    padding-left: 10px;
    border-left: 4px solid #667eea;
  }
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.card-header {
  margin-bottom: 10px;
  
  .card-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
  }
}

.card-content {
  font-size: 14px;
  color: #666;
  line-height: 1.5;
}

.avatar-section {
  .avatar-group {
    margin-top: 15px;
  }
}

.tag-section {
  .tag-group {
    display: flex;
    flex-wrap: wrap;
    margin-top: 15px;
  }
}

.input-section {
  margin-top: 15px;
}

.glass-header {
  margin-bottom: 15px;
  
  .glass-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
  }
}

.glass-content {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
}

.gradient-section {
  text-align: center;
  margin-top: 15px;
  
  .button-text {
    color: white;
    font-weight: 600;
  }
}

.animation-section {
  text-align: center;
  margin-top: 15px;
  padding: 30px;
}

/* 工具类 */
.ml-10 {
  margin-left: 10px;
}

.mt-10 {
  margin-top: 10px;
}

.mt-20 {
  margin-top: 20px;
}
</style>